package cn.iocoder.yudao.module.crm.dal.mysql.levelconfig;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.crm.controller.admin.levelconfig.vo.CrmLevelConfigPageReqVO;
import cn.iocoder.yudao.module.crm.dal.dataobject.levelconfig.CrmLevelConfigDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 客户级别 Mapper
 *
 * @author 数创万维
 */
@Mapper
public interface CrmLevelConfigMapper extends BaseMapperX<CrmLevelConfigDO> {
    default PageResult<CrmLevelConfigDO> selectPage(CrmLevelConfigPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CrmLevelConfigDO>()
                .likeIfPresent(CrmLevelConfigDO::getName, reqVO.getName())
//                .eqIfPresent(CrmLevelConfigDO::getModuleId, reqVO.getModuleId()) //configLevel不进行模块区分了
                .eqIfPresent(CrmLevelConfigDO::getSort, reqVO.getSort())
                .betweenIfPresent(CrmLevelConfigDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CrmLevelConfigDO::getSort));
    }
}